﻿@{ 
    var menusLeft = GetMenus(ThemeResources.MenuLocation.LeftSidebar, CurrentLanguage);
    var zoneLeftWidgets = GetWebSiteWidgets(CurrentLayout, ThemeResources.Zones.LeftSidebar);

    if (menusLeft.Count > 0 || zoneLeftWidgets.Count > 0)
    {
        HasLeftColumn = true;
        BodyWidth = BodyWidth - 2;
    }
}

@if (HasLeftColumn)
{
    <div class="col-sm-2 pull-left">

        <!-- Left Menu Start -->
        @if (menusLeft != null && menusLeft.Count > 0)
        {
            <div class="col-md-12">
                @foreach (var item in menusLeft)
                {
                    foreach (var menuItem in item.MenuItems)
                    {
                        <a href="@menuItem.Url">@menuItem.Name</a><br />
                        foreach (var mi2 in menuItem.Childrens)
                        {
                            <span>&nbsp;&nbsp;--</span><a href="@mi2.Url">@mi2.Name</a><br />
                            foreach (var mi3 in mi2.Childrens)
                            {
                                <span>&nbsp;&nbsp;&nbsp;&nbsp;--</span><a href="@mi3.Url">@mi3.Name</a><br />
                                foreach (var mi4 in mi3.Childrens)
                                {
                                    <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--</span><a href="@mi4.Url">@mi4.Name</a><br />
                                }
                            }
                        }
                    }
                }
            </div>
            <div class="clearfix"></div>
        }
        <!-- Left Menu End -->

        <!-- Left Sidebar Widgets Start -->
        @if (zoneLeftWidgets != null && zoneLeftWidgets.Count > 0)
        {
            <div class="row">
                @foreach (var item in zoneLeftWidgets)
                {
                    var widget = item.Widget;
                    widget.Init(item.Id);

                    if (string.IsNullOrEmpty(widget.Language) || string.IsNullOrEmpty(CurrentLanguage) || CurrentLanguage.ToLower() == widget.Language.ToLower())
                    {
                        if (widget.DisplayTitle.Trim() != "" || widget.Footer.Trim() != "")
                        {
                            <div class='panel panel-default'>
                                @if (widget.DisplayTitle != "")
                                {
                                    <div class='panel-heading'>
                                        @Html.Raw(_T[widget.DisplayTitle])
                                    </div>
                                }
                                <div class='panel-body'>
                                    @Html.Raw(widget.RenderBody())
                                </div>
                                @if (widget.Footer != "")
                                {
                                    <div class='panel-footer'>
                                        @Html.Raw(_T[widget.Footer])
                                    </div>
                                }
                            </div>
                        }
                        else
                        {
                            <div>
                                @Html.Raw(widget.RenderBody())
                            </div>
                        }
                    }                     
                }
            </div>
        }
        <!-- Left Sidebar Widgets End -->

    </div>
}